package main

import (
	"fmt"
	"github.com/garyburd/redigo/redis"
)

var pool *redis.Pool

func init(){
	pool = &redis.Pool{
		MaxIdle:8,
		MaxActive:0,
		IdleTimeout:100,
		Dial: func() (redis.Conn, error) {
			return redis.Dial("tcp", "127.0.0.1:6379")
		},
	}
}

func main() {
	conn := pool.Get()
	defer conn.Close()

	_, err :=conn.Do("set", "susu", "tomCat")
	if err != nil{
		fmt.Println("error")
		return
	}

	r, err := redis.String(conn.Do("get", "susu"))
	if err != nil{
		fmt.Println("error")
		return
	}
	fmt.Println(r)
}